/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */
@isTest
private class TestTaskAfterInsert_OnCallDisposition {

    static testMethod void myUnitTest() {
        test.starttest();
        Schema.DescribeSObjectResult d = Schema.SObjectType.Lead;
    	Map<String,Schema.RecordTypeInfo> rtMapByName = d.getRecordTypeInfosByName();
    	Schema.RecordTypeInfo rtByName =  rtMapByName.get('West - Prospective Student');
    	String RecTypeId  = rtByName.getRecordTypeId();
        Country__C co = new Country__c(Country_Code_2__c='23',Active__c=true,Economic_Grouping__c='HJJ',Language_Code__C='33');
        insert co;
        
        //1 lead
        Lead l=new Lead();
        l.email='john@john.com';
        l.firstname='John';
        l.Country_of_Birth__c =co.id;
        l.RecordTypeId=RecTypeId  ;
        l.Home_Phone__c ='9807654321';
        l.MobilePhone = '8976543210';
        l.Marketing_Phone__c='9876653';
        l.Other_Phone__c='66555234';
        l.Other_Phone_2__c='3232398987'; 
        l.lastname='Coppedge';
        l.Personal_Email__c='john@john.com';
        l.Other_Email__c='john@john.com';
        l.status='Appointment';
        l.street='test';
        l.state='CA';
        l.city='santa clara';
        l.postalcode='95051';
        l.country='USA';
        l.Country_of_Residence__c =Co.id;
        l.Work_Phone__c='(801) 555-5556';
        insert l;
        
        Group g;
        g = new Group();
        g.Type = 'Queue';
        g.Name = 'West - Email Only';
        g.DeveloperName = 'WestEmail';
        insert g;
        Group g1 = [Select id from group where DeveloperName = 'WestEmail'];
        
        List<Five9_Campaign_Management__c> f = new List<Five9_Campaign_Management__c>();
        Five9_Campaign_Management__c fcm;        
        fcm = new Five9_Campaign_Management__c();
        fcm.Name = 'Uncallable Permanently Disconn';
        fcm.Five9_Disposition__c = 'AGT:  UnCallable, Disconnected not Temporarily';
        fcm.Status_Update__c = 'Declined';
        fcm.Status_Detail_Update__c = 'Uncallable-Phone Number Temporarily disconnected';
        fcm.Change_Record_Owner__c = g1.id;
        fcm.Single_Number_Update__c = 'Disconnected';
        fcm.Take_Final_Disposition_Actions__c = true;
        fcm.When_No_Number_Present__c = true;
        f.add(fcm);
        fcm = new Five9_Campaign_Management__c();
        fcm.Name = 'DNC Single';
        fcm.Five9_Disposition__c = 'AGT:   DNC-Single Number';
        fcm.Status_Update__c = 'Declined';
        fcm.Status_Detail_Update__c = 'Uncallable-No Valid Phone Number/DNC';
        fcm.Change_Record_Owner__c = g1.id;
        fcm.Single_Number_Update__c = 'DNC';
        fcm.Take_Final_Disposition_Actions__c = true;
        fcm.When_No_Number_Present__c = true;
        f.add(fcm);
        insert f;
        
        Lead l1 = [select id from lead Limit 1];
        //2 tasks
        Task t = new Task();
    	t.subject = 'test';
    	t.status = 'In Progress';
    	t.CallDisposition = 'AGT:  UnCallable, Disconnected not Temporarily';
	    t.Five9__Five9DNIS__c = '9876653';
	    t.Five9__Five9Campaign__c = '9876653';
	    t.WhoId = l1.id; 
    	insert t;
    	
    	t.Five9__Five9DNIS__c = '9807654321';
    	t.CallDisposition = 'AGT:   DNC-Single Number';
        update t;
        
        t.Five9__Five9DNIS__c = '8976543210';
        t.CallDisposition = 'AGT:   DNC-Single Number';
        update t;
        
        t.Five9__Five9DNIS__c = '66555234';
        t.CallDisposition = 'AGT:   DNC-Single Number';
        update t;
        
        t.Five9__Five9DNIS__c = '8015555556';
        t.CallDisposition = 'AGT:   DNC-Single Number';
        update t;
        /*
        t.Five9__Five9DNIS__c = '3232398987';
        t.CallDisposition = 'AGT:   DNC-Single Number';
        update t;
        */
        
        
        
    }
}